package com.william.jdbcplus.core.enums;

public enum SqlMethod {
	/**
	 * 插入
	 */
	INSERT_ONE("insert", "插入一条数据（选择字段插入）", "INSERT INTO %s %s VALUES %s"),

	/**
	 * 插入多条
	 */
	INSERT_LIST("insertList", "插入多条数据", "INSERT INTO %s %s VALUES %s"),

	/**
	 * 物理删除
	 */
	DELETE_REAL("deleteReal", "根据 entity 条件删除记录", "DELETE FROM %s %s"),

	/**
	 * 逻辑删除
	 */
	DELETE_LOGIC("deleteLogic", "根据 entity 条件逻辑删除记录", "UPDATE %s SET %s %s"),

	/**
	 * 修改
	 */
	UPDATE_BY_MAP("updateByMap", "根据 whereEntity 条件，更新部分指定字段记录", "UPDATE %s SET %s %s"),

	/**
	 * 查询ID最大值
	 */
	SELECT_MAXID("selectMaxId", "查询ID最大值", "SELECT MAX(%s) FROM %s"),

	/**
	 * 查询数量
	 */
	SELECT_COUNT("selectCount", "查询满足条件总记录数", "SELECT COUNT(%s) FROM %s %s"),

	/**
	 * 查询列表
	 */
	SELECT_LIST("selectList", "查询满足条件所有数据", "SELECT %s FROM %s %s"),

	/**
	 * 查询分页
	 */
	SELECT_PAGE("selectPage", "查询满足条件所有数据（并翻页）", "SELECT %s FROM %s %s");

	private final String method;
	private final String desc;
	private final String sql;

	SqlMethod(String method, String desc, String sql) {
		this.method = method;
		this.desc = desc;
		this.sql = sql;
	}

	public String getMethod() {
		return method;
	}

	public String getDesc() {
		return desc;
	}

	public String getSql() {
		return sql;
	}

}
